package org.applicationflow

import _root_.org.applicationflow.utils.CallbackMap
import _root_.org.flowcircuit.utils.CallbackList
import command.{CommandId, Command}
import document.Document
import java.awt.Dimension
import org.applicationflow.utils.ParameterChecker._
import ui.ApplicationUi

/**
 * 
 */
class Application( name : String ) {

  val documents : CallbackList[Document] = CallbackList()

  val ui : ApplicationUi = new ApplicationUi( name, null, new Dimension( 1024, 800 ) )

  private val commands : CallbackMap[CommandId, Command] = CallbackMap()

  def addCommand( command : Command ) {
    requireNotNull( command, 'command )

    commands.put( command.id, command )
  }

  
  def removeCommand( id : CommandId ) = commands.remove( id )

  def start() {
    ui.init()
  }

}